package commandPatern;

import java.sql.SQLException;

import gui.containerDate.Item;
import gui.panels.PanelStudent;


public class SwitchComboBox implements Command {
	private Item itemOld;
	private Item itemNew;
	
	public SwitchComboBox(Item item) {
		this.itemOld = item;
		System.out.println("constructor");
	}
	
	public Item getNewItem() {
		return itemNew;
	}

	public void setItemNew(Item itemNew) {
		this.itemNew = itemNew;
		System.out.println("setItemNew");
	}


	
	public Item getOldItem() {
		return itemOld;
	}



	@Override
	public void undo() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException{
		PanelStudent.getInstance().setStudentTable(itemOld);
		PanelStudent.getInstance().getComboBox().setSelectedItem(itemOld);
	}

	@Override
	public void rendoo() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
		PanelStudent.getInstance().setStudentTable(itemNew);
		PanelStudent.getInstance().getComboBox().setSelectedItem(itemNew);
	}
	
	
}
